# docker rm demo
# docker run -it  --name demo -v /home/native-demo:/app/native-demo -v /home/wenjie/.m2/repository:/root/.m2/repository registry.cn-chengdu.aliyuncs.com/wanrue/graalvm17:latest  bash
FROM registry.cn-chengdu.aliyuncs.com/wanrue/graalvm17:latest AS build
# 设置工作目录
WORKDIR /app
COPY . .
RUN mvn -Pnative -DskipTests native:compile

FROM oraclelinux:9-slim AS runtime
# 设置工作目录
WORKDIR /app
# 将构建阶段的原生可执行文件复制到运行镜像
COPY --from=build /app/target/native-demo /app/native-app
# 确保可执行文件有运行权限
RUN chmod +x /app/native-app
# 暴露服务使用的端口
EXPOSE 8080
# 设置启动命令（运行原生二进制文件）
CMD ["/app/native-app"]